package com.scd.sort;

import java.util.Arrays;

public class SortUtil {
	
	public static void swap(int a, int b){
		int temp = a;
		a = b;
		b = temp;
	}
	
	public static void swap(ExVo a, ExVo b){
		Integer temp = a.getI();
		a.setI(b.getI());
		b.setI(temp);
	}
	
	public static void swap(int a, int b, int[] array){
		int temp = array[a];
		array[a] = array[b];
		array[b] = temp;
	}

	public static void main(String[] args) {
		int a = 1;
		int b = 2;
		System.out.println("o : a="+a+",b="+b);
		swap(a,b);
		System.out.println("s : a="+a+",b="+b);
		ExVo e1 = new ExVo(1);
		ExVo e2 = new ExVo(2);
		System.out.println("O��"+e1.getI()+","+e2.getI());
		swap(e1, e2);
		System.out.println("S: "+e1.getI()+","+e2.getI());
		System.out.println("=======���齻��==========");
		int[] arr = {1,2,3};
		System.out.println("origin arr: "+Arrays.toString(arr));
		swap(0,1, arr);
		System.out.println("swap   arr: "+Arrays.toString(arr));
	}

}
